﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FrameSidebar.aspx.cs" Inherits="BEGDC.CC.Web.FrameSidebar"
    EnableViewState="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title></title>
    <link href="css/global.css" rel="stylesheet" type="text/css" />
    <link href="css/sidebar.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>

    <script type="text/javascript">
        $(document).ready(function() {

            var animationTimespan = 300;
            var firstMenus = $(".sidebarbox > a.menu");
            var secondMenus = $(".submenu a");

            var closeAll = function(thismenu) {
                $(".sidebarbox > .submenubox").each(function() {
                    if (!$(this).is(":hidden")) {
                        $(this).hide(animationTimespan);
                        if ($(this).prev().prev().is("a")) {
                            $(this).prev().prev().addClass('menu').removeClass('menuexpand');
                        }
                    }
                });
            };


            // 一级菜单
            firstMenus.bind("click", function() {
                var $ul = $(this).next().next();
                if (!$ul.is("ul")) {
                    return false;
                }

                if ($ul.is(":hidden")) {
                    closeAll(this);
                    $ul.show(animationTimespan);
                    $(this).addClass('menuexpand').removeClass('menu');
                }
            });


            // 二级菜单
            secondMenus.bind("click", function() {
                $(".submenu a").removeClass("current");
                $(this).addClass("current");
                changeSubItem($(this).attr("url"));
            });


            // 加载页面时默认选择第一个一级菜单以及下面的第一个二级菜单
            firstMenus.eq(0).click();
            secondMenus.eq(0).click();

        });
        
        
        function changeSubItem(target) {
            if (target.toString().toLowerCase() == "workflow/evsummary.aspx") {
                window.open('workflow/workflowexecution.aspx?PDType=EV&Type=App', '', 'height=640,width=800,status=no,scrollbars=yes,toolbar=no,menubar=no,location=no,resizable=yes');
            }
            else if (target.toString().toLowerCase() == "workflow/crsummary.aspx") {
            window.open('workflow/WorkflowExecution.aspx?PDType=CR&Transition=0&Type=App', '', 'height=700,width=1000,status=no,scrollbars=yes,toolbar=no,menubar=no,location=no,resizable=yes');
            }
            else {
                top.mainFrame.location = target;
            }
        }

    </script>

</head>
<body>
    <form runat="server">
    <div class="sidebarbox">
        <asp:ObjectDataSource ID="odsSidebar" runat="server" SelectMethod="GetSidebarMenu"
            TypeName="ASBCC.Business.MenuHelper">
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="0" Name="sysFID" QueryStringField="c" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <asp:Repeater runat="server" DataSourceID="odsSidebar">
            <ItemTemplate>
                <a class="menu" title="<%#Eval("H2Desc") %>">
                    <%#Eval("H2") %></a><span class="menufooter"></span>
                <ul class="submenubox">
                    <asp:Repeater runat="server" DataSource='<%#Eval("H3List") %>'>
                        <ItemTemplate>
                            <li class="submenu"><a href="javascript:void(0)" title="<%#Eval("H3Desc") %>" url="<%#Eval("Url") %>">
                                <%#Eval("H3") %> <%#Eval("H3Desc") %></a></li>
                        </ItemTemplate>
                    </asp:Repeater>
                </ul>
            </ItemTemplate>
        </asp:Repeater>
    </div>
    </form>
</body>
</html>
